package com.su.kddq.service.courier.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.su.kddq.entity.user.Role;
import com.su.kddq.mapper.courier.RoleMapper;
import com.su.kddq.service.courier.RoleService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * 角色 service
 * @author sx
 */
@Service
public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements RoleService {
    /**
     * 按用户 ID 选择权限值
     * @param id
     * @return
     */
    @Override
    public List<Integer> selectPermissionValueByUserId(Integer id) {
        List<Integer> selectPermissionValueList = new ArrayList<>();
        Role role = this.getOne(new QueryWrapper<Role>().select("role_code").eq("id", id));
        selectPermissionValueList.add(role.getRoleCode());
        return selectPermissionValueList;
    }
}
